//
//  daoConstructorMacros.h
//  Oos4ios
//
//  Created by Pablo Gonzalez on 3/9/11.
//

#define constructorsFromService(type) \
+ (type) daoFromService: (OosService *) service; \
- (type) initFromService: (OosService *) service; \
+ (type) daoFromServiceSlug: (NSString *) serviceSlug; \
- (type) initFromServiceSlug: (NSString *) serviceSlug;

#define constructorsFromUser(type) \
+ (type) daoFromUser: (OosUser *) user; \
- (type) initFromUser: (OosUser *) user; \
+ (type) daoFromUserSlug: (NSString *) userSlug; \
- (type) initFromUserSlug: (NSString *) userSlug;

#define constructorsImplFromService(type, mockType) \
+ (type) daoFromServiceSlug:(NSString *)serviceSlug\
{\
return [[[mockType alloc] initFromServiceSlug:serviceSlug] autorelease];\
}\
- (type) initFromServiceSlug:(NSString *)serviceSlug\
{\
self = [super init];\
if (self) {\
[[self delegate] setServiceSlug: serviceSlug];\
}\
return self;\
}\
+ (type) daoFromService:(OosService *)service\
{\
return [[[mockType alloc] initFromService:service] autorelease];\
}\
- (type) initFromService:(OosService *)service\
{\
self = [self init];\
if (self) {\
[[self delegate] setServiceSlug: [service slug]];\
[[self delegate] setService: service];\
}\
return self;\
}

#define constructorsImplFromUser(type, mockType) \
+ (type) daoFromUserSlug:(NSString *)userSlug\
{\
return (type) [[[mockType alloc] initFromUserSlug:userSlug] autorelease];\
}\
- (type) initFromUserSlug:(NSString *)userSlug\
{\
self = [super init];\
if (self) {\
[[self delegate] setUserSlug: userSlug];\
}\
return self;\
}\
+ (type) daoFromUser:(OosUser *)user\
{\
return (type) [[[mockType alloc] initFromUser:user] autorelease];\
}\
- (type) initFromUser:(OosUser *)user\
{\
self = [self init];\
if (self) {\
[[self delegate] setUserSlug: [user slug]];\
[[self delegate] setUser: user];\
}\
return self;\
}
